{% macro render_pagination(pagination,endpoint) %}
    <div class="text-center">
        <ul class="pagination">
            <li><a href="{{ url_for(endpoint,page=1) }}">首页</a></li>

            {% if pagination.has_prev %}
                <li><a href="{{ url_for(endpoint,page=pagination.prev_num) }}">«</a></li>
            {% endif %}

            {% for page in pagination.iter_pages() %}
                {% if page %}
                    {% if page != pagination.page %}
                        <li><a href="{{url_for(endpoint,page=page)}}">{{ page }}</a></li>
                    {% else %}
                        <li class="active"><a href="#">{{ page }}</a></li>
                    {% endif %}
                {% endif %}
            {% endfor %}

            {% if pagination.has_next %}
                <li><a href="{{ url_for(endpoint,page=pagination.next_num) }}">»</a></li>
            {% endif %}

            <li><a href="{{ url_for(endpoint,page=pagination.pages) }}">末页</a></li>
        </ul>
    </div>
{% endmacro %}